package com.seashop.exception;

import com.seashop.enums.ResponseEnum;
import lombok.Getter;

/**
 * @author moredln
 * @desc 统一异常
 * @date 2020-08-11 16:08
 */
@Getter
public class ResponseException extends RuntimeException {

    private static final long serialVersionUID = -3008701086164361883L;

    private int code;

    private String msg;

    public ResponseException(ResponseEnum responseEnum) {
        super(responseEnum.getMsg());
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMsg();
    }

    public ResponseException(int code, String msg, Throwable cause) {
        super(msg, cause);
        this.code = code;
        this.msg = msg;
    }

    public ResponseException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public ResponseException(String msg) {
        super(msg);
        this.code = ResponseEnum.BEAN_COPY_FAIL.getCode();
        this.msg = msg;
    }

    public ResponseException() {
        super();
    }

    public ResponseException(String message, Throwable cause) {
        super(message, cause);
    }

    public ResponseException(Throwable cause) {
        super(cause);
    }

}
